﻿<%@ Page Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="AddNewQuote.aspx.cs"
    Inherits="Web.Quote.AddNewQuote" Title="Xtablish CRM / New Quote" %>

<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>

<asp:Content ID="BodyContent" ContentPlaceHolderID="Con1" runat="Server">
    <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
        <script type="text/javascript">
            var index;
            function WebForm_OnSubmit() {
                if (typeof (ValidatorOnSubmit) == "function" && ValidatorOnSubmit() == false) {
                    $("#validation_dialog").dialog({
                        title: "Validation Error!",
                        modal: true,
                        resizable: false,
                        buttons: {
                            Close: function () {
                                $(this).dialog('close');
                            }
                        }
                    });
                    return false;
                }
                return true;
            }
            function CancelClick() {
                window.location.assign(document.getElementById('<%= hdntxtPrevPage.ClientID %>').value);
            }
            function disableKeyPress(evt) {
                return false;
            }
            function isNumberKey(evt) {
                var charCode = (evt.which) ? evt.which : event.keyCode
                if (charCode > 31 && (charCode < 48 || charCode > 57))
                    return false;
                return true;
            }
            function openProductSearchWindow(rowIndex) {
                index = rowIndex;
                openWin("../SearchPopup/Product.aspx", "rwProduct");
                return false;
            }
            function openRadWin(url, formname) {
                var orgID = document.getElementById('<%= hdntxtOrgID.ClientID %>').value;
               var orgName = document.getElementById('<%= hdntxtOrgName.ClientID %>').value;
               if (orgID != "")
                   openWin(url + "?OrgID=" + orgID + "&OrgName=" + orgName, formname);
               else
                   ShowMessage("Please choose company name first !");
           }
            function OnClientClose(oWnd, args) {
                //get the transferred arguments
                var arg = args.get_argument();
                if (arg) {
                    var searchType = arg.SearchType;
                    if (searchType == "Contact") {
                        var ContactName = arg.ContactName;
                        var ContactID = arg.ContactID;
                        document.getElementById('<%= hdntxtConName.ClientID %>').value = ContactName;
                        document.getElementById('<%= hdntxtConID.ClientID %>').value = ContactID;
                        document.getElementById('<%= txtContactName.ClientID %>').value = ContactName;
                    }

                    else if (searchType == "Organization") {
                        var orgName = arg.OrgName;
                        var orgID = arg.OrgID;
                        document.getElementById('<%= hdntxtOrgName.ClientID %>').value = orgName;
                        document.getElementById('<%= hdntxtOrgID.ClientID %>').value = orgID;
                        document.getElementById('<%= txtOrganizationName.ClientID %>').value = orgName;
                    }
                    else if (searchType == "Product") {
                        var productImage = arg.ProductImage;
                        var productID = arg.ProductID;
                        var productName = arg.ProductName;
                        var productDes = arg.ProductDes;
                        var productGST = arg.ProductGST;
                        var productUnitPrice = arg.ProductUnitPrice;
                        document.getElementById('<%= hdntxtProductImage.ClientID %>').value = productImage;
                        document.getElementById('<%= hdntxtProductID.ClientID %>').value = productID;
                        document.getElementById('<%= hdntxtProductName.ClientID %>').value = productName;
                        document.getElementById('<%= hdntxtProductDes.ClientID %>').value = productDes;
                        document.getElementById('<%= hdntxtProductGST.ClientID %>').value = productGST;
                        document.getElementById('<%= hdntxtProductUnitPrice.ClientID %>').value = productUnitPrice;
                    }
                }
                document.getElementById('<%= hdntxtCurrentRow.ClientID %>').value = index;
                document.getElementById('<%= btnCloseRadWin.ClientID %>').click();
        }

        function clearConName() {
            document.getElementById('<%= hdntxtConName.ClientID %>').value = null;
            document.getElementById('<%= hdntxtConID.ClientID %>').value = null;
            document.getElementById('<%= txtContactName.ClientID %>').value = null;
        }
        function clearOrgName() {
            document.getElementById('<%= hdntxtOrgName.ClientID %>').value = null;
            document.getElementById('<%= hdntxtOrgID.ClientID %>').value = null;
            document.getElementById('<%= txtOrganizationName.ClientID %>').value = null;

            document.getElementById('<%= hdntxtConName.ClientID %>').value = null;
            document.getElementById('<%= hdntxtConID.ClientID %>').value = null;
            document.getElementById('<%= txtContactName.ClientID %>').value = null;
        }
        function rbtnPercent_Clicked() {
            var grid = $find("<%= RadGrid1.ClientID %>");
            var masterTableView = grid.get_masterTableView();
            var rbtnPercent, divDiscountPercent, divDiscountPrice;
            var row = masterTableView.get_dataItems()[index];
            var rntxtDiscountPercent = row.findControl("rntxtDiscountPercent");
            var rntxtDiscountPrice = row.findControl("rntxtDiscountPrice");
            var divDiscountPercent = row.findElement("divDiscountPercent");
            var divDiscountPrice = row.findElement("divDiscountPrice");
            var rbtnPercent = row.findControl("rbtnPercent");
            if (rbtnPercent.get_checked()) {
                divDiscountPercent.style.display = "block";
                divDiscountPrice.style.display = "none";
                rntxtDiscountPercent.set_value(rntxtDiscountPrice.get_value());
            }
            else {
                divDiscountPercent.style.display = "none";
                divDiscountPrice.style.display = "block";
                rntxtDiscountPrice.set_value(rntxtDiscountPercent.get_value());
            }
            valueChanged();
        }
        function valueChanged() {
            var grid = $find("<%= RadGrid1.ClientID %>");
            var masterTableView = grid.get_masterTableView();
            var rbtnPercent, divDiscountPercent, divDiscountPrice;
            var row = masterTableView.get_dataItems()[index];
            var rntxtUnitPrice = row.findControl("rntxtUnitPrice");
            var rntxtQuantity = row.findControl("rntxtQuantity");
            var rntxtDiscountPercent = row.findControl("rntxtDiscountPercent");
            var rntxtDiscountPrice = row.findControl("rntxtDiscountPrice");
            var rbtnPercent = row.findControl("rbtnPercent");
            var rntxtGST = row.findControl("rntxtGST");
            var rntxtTotalPrice = row.findControl("rntxtTotalPrice");
            var discountprice = 0;
            var totalprice = rntxtUnitPrice.get_value() * rntxtQuantity.get_value();
            totalprice = totalprice + totalprice * (rntxtGST.get_value() / 100.0);
            if (rbtnPercent.get_checked()) {
                discountprice = (totalprice) * (rntxtDiscountPercent.get_value() / 100.0);
            }
            else {
                discountprice = rntxtDiscountPrice.get_value();
            }
            totalprice = totalprice - discountprice;
            if (totalprice < 0) totalprice = 0;
            rntxtTotalPrice.set_value(totalprice);
        }
        var sumInput = null;
        function Load(sender, args) {
            sumInput = sender;
        }
        function OnBlur(sender, args) {
            if (sender.get_value() == "") {
                sender.set_value("0");
            }
        }
        function TotalPriceOnValueChanged(sender, args) {
            var tempValue = 0.0;
            var grid = $find("<%= RadGrid1.ClientID %>");
            var masterTableView = grid.get_masterTableView();
            var rows = masterTableView.get_dataItems();
            for (var i = 0; i < rows.length; i++) {
                var rntxtTotalPrice = rows[i].findControl("rntxtTotalPrice");
                tempValue += rntxtTotalPrice.get_value();
            }
            sumInput.set_value(tempValue);
        }
            function Select(i) {
                index = i;
            }

            function disableKeyPress(evt) {
                return false;
            }
        </script>
    </telerik:RadCodeBlock>
    <asp:HiddenField ID="hdntxtPrevPage" runat="server"></asp:HiddenField>
    <asp:HiddenField ID="hdntxtConName" runat="server"></asp:HiddenField>
    <asp:HiddenField ID="hdntxtConID" runat="server"></asp:HiddenField>
    <asp:HiddenField ID="hdntxtOrgName" runat="server"></asp:HiddenField>
    <asp:HiddenField ID="hdntxtOrgID" runat="server"></asp:HiddenField>
    <asp:HiddenField ID="hdntxtCurrentRow" runat="server"></asp:HiddenField>
    <asp:HiddenField ID="hdntxtProductID" runat="server"></asp:HiddenField>
    <asp:HiddenField ID="hdntxtProductName" runat="server"></asp:HiddenField>
    <asp:HiddenField ID="hdntxtProductDes" runat="server"></asp:HiddenField>
    <asp:HiddenField ID="hdntxtProductGST" runat="server"></asp:HiddenField>
    <asp:HiddenField ID="hdntxtProductImage" runat="server"></asp:HiddenField>
    <asp:HiddenField ID="hdntxtProductUnitPrice" runat="server"></asp:HiddenField>
     
    <div class="register">
        <div class="container-fluid">
            <div class="row">
                <div class="col-md-6">
                    <h3>Creating New Quote</h3>
                </div>
                <div class="col-md-6 btn-edit">
                   <asp:LinkButton id="btnTop_Save" type="button" runat="server" class="btn btn-defaul" OnClick="btn_Save_Click">
                        <img src="../Images/save.png" style="width: 18px; height: 18px" /> Save
                    </asp:LinkButton>
                    <div id="validation_dialog" style="display: none">
                        <asp:ValidationSummary ID="ValidationSummary1" runat="server" />
                    </div>
                    <asp:LinkButton id="btnTop_Cancel" type="button" runat="server" class="btn btn-defaul" OnClientClick="CancelClick()" CausesValidation="false">
                        <img src="../Images/back.png" style="width: 18px; height: 18px" /> Back
                    </asp:LinkButton>
                </div>
            </div>
            <div class="row">
                <div class="edit-form highlight">
                    <div class="control-group">
                        <h4>Quote Details</h4>
                    </div>
                    <div class="control-group">
                        <div class="col-md-6 distance-control">
                            <div class="col-md-4">
                                <label class="control-label">Subject <span class="red-star">*</span></label>
                            </div>
                            <div class="col-md-8">
                                <div class="controls">
                                    <asp:TextBox ID="txtSubject" runat="server" class="form-control" data-validate="required" />
                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" Display="None" ControlToValidate="txtSubject"
                                        runat="server" ErrorMessage="Subject is required."></asp:RequiredFieldValidator>
                                </div>
                            </div>
                        </div>
                        <div class="col-md-6 distance-control">
                            <div class="col-md-4">
                                <label class="control-label">Quote Stage <span class="red-star">*</span></label>
                            </div>
                            <div class="col-md-8">
                                <div class="controls">
                                    <telerik:RadComboBox ID="ddlQuoteStage" runat="server" class="form-control" DataTextField="QUOTE_STAGE_NAME" DataValueField="ID"
                                        Width="60%" Filter="StartsWith" MaxHeight="700px" />
                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator2" Display="None" ControlToValidate="ddlQuoteStage"
                                        runat="server" ErrorMessage="Quote Stage is required."></asp:RequiredFieldValidator>
                                </div>
                            </div>

                        </div>
                        <div class="clearfix"></div>
                    </div>
                    <div class="control-group">
                        <div class="col-md-6 distance-control">
                            <div class="col-md-4">
                                <label class="control-label">Company Name </label>
                            </div>
                            <div class="col-md-8">
                                <div class="controls">
                                   <asp:TextBox ID="txtOrganizationName" runat="server" class="form-control form-fl" onkeypress="return disableKeyPress(event)" />
                                    <div class="btn-sl" style="padding-top:2px">
                                        <asp:LinkButton ID="LinkButton1" runat="server" OnClientClick="openWin('../../SearchPopUp/Organization.aspx', 'rwOrganization'); return false;" ToolTip="Search">
                                            <img src="../Images/search.png" style="width: 18px; height: 18px" />
                                        </asp:LinkButton>
                                        <asp:LinkButton ID="LinkButton2" runat="server" OnClientClick="clearOrgName();return false;" ToolTip="Clear">
                                            <img src="../Images/delete.png" style="width: 16px; height: 16px" />
                                        </asp:LinkButton>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="col-md-6 distance-control">
                            <div class="col-md-4">
                                <label class="control-label">Contact Name </label>
                            </div>
                            <div class="col-md-8">
                                <div class="controls">
                                    <asp:TextBox ID="txtContactName" runat="server" class="form-control form-fl" onkeypress="return disableKeyPress(event)" />
                                    <div class="btn-sl" style="padding-top:2px">
                                        <asp:LinkButton ID="LinkButton3" runat="server" OnClientClick="openRadWin('../../SearchPopUp/Contact.aspx', 'rwContact'); return false;" ToolTip="Search">
                                            <img src="../Images/search.png" style="width: 18px; height: 18px" />
                                        </asp:LinkButton>
                                        <asp:LinkButton ID="LinkButton4" runat="server" OnClientClick="clearConName();return false;" ToolTip="Clear">
                                            <img src="../Images/delete.png" style="width: 16px; height: 16px" />
                                        </asp:LinkButton>
                                    </div>
                                </div>
                            </div>
                        </div>
                       
                        <div class="clearfix"></div>
                    </div>
                    <div class="control-group">
                         <div class="col-md-6 distance-control">
                            <div class="col-md-4">
                                <label class="control-label">Valid Until</label>
                            </div>
                            <div class="col-md-8">
                                <div class="controls">
                                    <telerik:RadDatePicker ID="dpValidUntil" runat="server" Width="50%">
                                        <DateInput ReadOnly="true" ID="RadDateInput1" runat="server">
                                        </DateInput>
                                        <Calendar ReadOnly="true" ID="Calendar1" runat="server" UseColumnHeadersAsSelectors="False"
                                            UseRowHeadersAsSelectors="False" ViewSelectorText="x">
                                            <SpecialDays>
                                                <telerik:RadCalendarDay Repeatable="Today" ItemStyle-CssClass="rcToday">
                                                </telerik:RadCalendarDay>
                                            </SpecialDays>
                                        </Calendar>
                                    </telerik:RadDatePicker>
                                </div>
                            </div>
                        </div>
                        
                        <div class="col-md-6 distance-control" id="divAssignedTo" runat="server">
                            <div class="col-md-4">
                                <label class="control-label">Assigned To </label>
                            </div>
                            <div class="col-md-8">
                                <div class="controls">
                                    <telerik:RadComboBox ID="ddlAssignedTo" runat="server" class="form-control"
                                        Width="60%" Filter="StartsWith" MaxHeight="700px" />

                                </div>
                            </div>
                        </div>
                        <div class="clearfix"></div>
                    </div>


                </div>
            </div>
            <!-- end row 1 -->
            <div class="row">
                <div class="edit-form highlight">
                    <div class="control-group">
                        <h4>Address Details</h4>
                    </div>
                    <div class="control-group">
                        <div class="col-md-6 distance-control">
                            <div class="col-md-4">
                                <label class="control-label">Office Address </label>
                            </div>
                            <div class="col-md-8">
                                <div class="controls">
                                    <asp:TextBox ID="txtOfficeAddress" runat="server" TextMode="MultiLine" class="form-control" Rows="1"></asp:TextBox>
                                </div>
                            </div>
                        </div>
                        <div class="col-md-6 distance-control">
                            <div class="col-md-4">
                                <label class="control-label">Home Address </label>
                            </div>
                            <div class="col-md-8">
                                <div class="controls">
                                    <asp:TextBox ID="txtHomeAddress" runat="server" TextMode="MultiLine" class="form-control" Rows="1"></asp:TextBox>
                                </div>
                            </div>

                        </div>
                        <div class="clearfix"></div>
                    </div>
                    <div class="control-group">
                        <div class="col-md-6 distance-control">
                            <div class="col-md-4">
                                <label class="control-label">Office PO Box</label>
                            </div>
                            <div class="col-md-8">
                                <div class="controls">
                                    <asp:TextBox ID="txtOfficePOBox" runat="server" class="form-control" />
                                </div>
                            </div>
                        </div>
                        <div class="col-md-6 distance-control">
                            <div class="col-md-4">
                                <label class="control-label">Home PO Box</label>
                            </div>
                            <div class="col-md-8">
                                <div class="controls">
                                    <asp:TextBox ID="txtHomePOBox" runat="server" class="form-control" />
                                </div>
                            </div>
                        </div>
                        <div class="clearfix"></div>
                    </div>
                    <div class="control-group">
                        <div class="col-md-6 distance-control">
                            <div class="col-md-4">
                                <label class="control-label">Office City</label>
                            </div>
                            <div class="col-md-8">
                                <div class="controls">
                                    <asp:TextBox ID="txtOfficeCity" runat="server" class="form-control" />
                                </div>
                            </div>
                        </div>
                        <div class="col-md-6 distance-control">
                            <div class="col-md-4">
                                <label class="control-label">Home City</label>
                            </div>
                            <div class="col-md-8">
                                <div class="controls">
                                    <asp:TextBox ID="txtHomeCity" runat="server" class="form-control" />
                                </div>
                            </div>
                        </div>
                        <div class="clearfix"></div>
                    </div>
                    <div class="control-group">
                        <div class="col-md-6 distance-control">
                            <div class="col-md-4">
                                <label class="control-label">Office State</label>
                            </div>
                            <div class="col-md-8">
                                <div class="controls">
                                    <asp:TextBox ID="txtOfficeState" runat="server" class="form-control" />
                                </div>
                            </div>
                        </div>
                        <div class="col-md-6 distance-control">
                            <div class="col-md-4">
                                <label class="control-label">Home State</label>
                            </div>
                            <div class="col-md-8">
                                <div class="controls">
                                    <asp:TextBox ID="txtHomeState" runat="server" class="form-control" />
                                </div>
                            </div>

                        </div>
                        <div class="clearfix"></div>
                    </div>
                    <div class="control-group">
                        <div class="col-md-6 distance-control">
                            <div class="col-md-4">
                                <label class="control-label">Office Postal Code </label>
                            </div>
                            <div class="col-md-8">
                                <div class="controls">
                                    <asp:TextBox ID="txtOfficePostalCode" runat="server" class="form-control" />
                                </div>
                            </div>
                        </div>
                        <div class="col-md-6 distance-control">
                            <div class="col-md-4">
                                <label class="control-label">Home Postal Code</label>
                            </div>
                            <div class="col-md-8">
                                <div class="controls">
                                    <asp:TextBox ID="txtHomePostalCode" runat="server" class="form-control" />
                                </div>
                            </div>
                        </div>
                        <div class="clearfix"></div>
                    </div>
                    <div class="control-group">
                        <div class="col-md-6 distance-control">
                            <div class="col-md-4">
                                <label class="control-label">Office Country </label>
                            </div>
                            <div class="col-md-8">
                                <div class="controls">
                                    <asp:TextBox ID="txtOfficeCountry" runat="server" class="form-control" />
                                </div>
                            </div>
                        </div>
                        <div class="col-md-6 distance-control">
                            <div class="col-md-4">
                                <label class="control-label">Home Country </label>
                            </div>
                            <div class="col-md-8">
                                <div class="controls">
                                    <asp:TextBox ID="txtHomeCountry" runat="server" class="form-control" />
                                </div>
                            </div>
                        </div>
                        <div class="clearfix"></div>
                    </div>
                </div>
            </div>
            <!-- end row 3-->
            <div class="row">
                <div class="edit-form highlight">
                    <div class="control-group">
                        <h4>Item Details</h4>
                    </div>
                    <div class="col-md-12 combobox-email">
                        <div class="col-md-8 btn-edit">
                            <button id="btnAddProduct" type="button" class="btn btn-defaul" runat="server" onserverclick="btnAddProduct_ServerClick" causesvalidation="false">
                               <img src="../Images/add.png" style="width: 16px; height: 16px" />
                                    Add Product
                            </button>
                             <button id="btnCloseRadWin" type="button" class="btn btn-defaul" runat="server" onserverclick="btnCloseRadWin_ServerClick" causesvalidation="false" style="display: none">
                                <img src="../Images/add.png" style="width: 16px; height: 16px" />
                                Add Product
                            </button>
                        </div>
                    </div>
                    <div class="clearfix"></div>
                    <div style="width: 100%">
                        <telerik:RadGrid ID="RadGrid1" ShowStatusBar="True" runat="server" AllowPaging="True" AllowSorting="True" AllowMultiRowSelection="True" OnItemCreated="RadGrid1_ItemCreated"
                            AutoGenerateColumns="False" GridLines="None" Width="100%" OnNeedDataSource="RadGrid1_NeedDataSource" OnItemCommand="RadGrid1_ItemCommand"
                            OnItemDataBound="RadGrid1_ItemDataBound" ShowFooter="True">
                            <MasterTableView PageSize="10" NoDetailRecordsText="No records" NoMasterRecordsText="No records" ShowHeader="true" TableLayout="Fixed" ClientDataKeyNames="ProductID"
                                DataKeyNames="ID,ProductID,ProductName,UnitPrice">
                                <Columns>
                                     <telerik:GridBoundColumn DataField="ProductID" UniqueName="ProductID" Display="false">
                                    </telerik:GridBoundColumn>
                                     <telerik:GridTemplateColumn HeaderText="Item Image" UniqueName="ITEM_IMAGE">
                                        <HeaderStyle Font-Bold="true" HorizontalAlign="center" Width="8.5%" />
                                        <ItemStyle HorizontalAlign="center" Width="8.5%" />
                                        <FooterStyle HorizontalAlign="center" Width="80px" BackColor="LightBlue" Font-Bold="true" />
                                        <ItemTemplate>
                                            <asp:Image ID="productImage" runat="server" ImageUrl='<%# Bind( "IMAGE") %>' Style="width: 80px; height: 80px" />
                                        </ItemTemplate>
                                    </telerik:GridTemplateColumn>
                                    <telerik:GridTemplateColumn HeaderText="Item Name" UniqueName="Column1" Aggregate="Count" FooterText="Total products: " DataField="ProductName">
                                        <HeaderStyle Font-Bold="true" HorizontalAlign="center" Width="18%" />
                                         <ItemStyle Wrap="false" HorizontalAlign="center" Width="18%" CssClass="paddingright" />
                                        <FooterStyle HorizontalAlign="center" Width="18%" BackColor="LightBlue" Font-Bold="true" />
                                        <ItemTemplate>
                                            <div style="width: 100%">
                                                <table style="width: 100%">
                                                    <tr>
                                                        <td style="width: 75%; padding: 0; border-right: none !important">
                                                            <asp:TextBox ID="txtProductName" runat="server" placeholder="Product Name" onkeypress="return disableKeyPress(event)"
                                                                Text='<%# Bind( "ProductName") %>' CssClass="form-control" Width="100%" TextMode="MultiLine" Rows="2"></asp:TextBox>
                                                        </td>
                                                        <td style="width: 25%; padding: 0; text-align: center; border: none !important">
                                                            <asp:LinkButton ID="lbtnProductSearch" runat="server" ToolTip="Search">
                                                                <img src="../Images/search.png" style="width: 18px; height: 18px" />
                                                            </asp:LinkButton>
                                                            <asp:LinkButton ID="lbtnProductClear" CommandName="Clear" runat="server" ToolTip="Clear">
                                                                <img src="../Images/delete.png" style="width: 16px; height: 16px" />
                                                            </asp:LinkButton>
                                                        </td>
                                                    </tr>
                                                </table>
                                            </div>
                                        </ItemTemplate>
                                    </telerik:GridTemplateColumn>
                                    <telerik:GridTemplateColumn HeaderText="Item Description" UniqueName="Column1">
                                        <HeaderStyle Font-Bold="true" HorizontalAlign="center" Width="21%" />
                                         <ItemStyle Wrap="false" HorizontalAlign="center" Width="22%" />
                                        <FooterStyle HorizontalAlign="center" Width="22%" BackColor="LightBlue" />
                                        <ItemTemplate>
                                            <asp:TextBox ID="txtProductDescription" runat="server" TextMode="MultiLine" placeholder="Product Description"
                                                Text='<%# Bind( "ProductDescription") %>' CssClass="form-control" Rows="2" Width="100%"></asp:TextBox>
                                        </ItemTemplate>
                                    </telerik:GridTemplateColumn>
                                    <telerik:GridTemplateColumn HeaderText="GST(%)" UniqueName="Column1">
                                        <HeaderStyle Font-Bold="true" HorizontalAlign="center" Width="7%" />
                                        <ItemStyle HorizontalAlign="center" Width="7%" />
                                        <FooterStyle HorizontalAlign="center" Width="7%" BackColor="LightBlue" />
                                        <ItemTemplate>
                                            <asp:Panel Style="width: 100%" ID="divGST" runat="server">
                                                <telerik:RadNumericTextBox ShowSpinButtons="false" Type="Percent" ID="rntxtGST" runat="server" ClientEvents-OnValueChanged="valueChanged" MinValue="0" OnTextChanged="rntxtGST_TextChanged"
                                                    Width="100%" CssClass="RadNumbericText">
                                                    <ClientEvents OnBlur="OnBlur" />
                                                </telerik:RadNumericTextBox>
                                            </asp:Panel>
                                        </ItemTemplate>
                                    </telerik:GridTemplateColumn>
                                    <telerik:GridTemplateColumn HeaderText="Unit Price" UniqueName="Column1" DataField="UnitPrice">
                                        <HeaderStyle Font-Bold="true" HorizontalAlign="center" Width="9%" />
                                        <ItemStyle HorizontalAlign="center" Width="10%" />
                                        <FooterStyle HorizontalAlign="center" Width="10%" BackColor="LightBlue" />
                                        <ItemTemplate>
                                            <telerik:RadNumericTextBox ShowSpinButtons="false" EmptyMessage="$" Type="Currency" ID="rntxtUnitPrice" runat="server" ClientEvents-OnValueChanged="valueChanged" MinValue="0" OnTextChanged="rntxtUnitPrice_TextChanged"
                                                Width="100%" CssClass="RadNumbericText" DbValue='<%# Eval("UnitPrice") %>' >
                                                <ClientEvents OnBlur="OnBlur" />
                                            </telerik:RadNumericTextBox>
                                        </ItemTemplate>
                                    </telerik:GridTemplateColumn>
                                    <telerik:GridTemplateColumn HeaderText="Discount Price" UniqueName="DiscountPrice" DataField="DiscountPrice">
                                        <HeaderStyle Font-Bold="true" HorizontalAlign="center" Width="12%" />
                                        <ItemStyle HorizontalAlign="center" Width="13%" />
                                        <FooterStyle HorizontalAlign="center" Width="13%" BackColor="LightBlue" />
                                        <ItemTemplate>
                                            <div style="width: 100%">
                                                <telerik:RadButton ID="rbtnPercent" runat="server" ToggleType="Radio" ButtonType="ToggleButton" OnClientCheckedChanged="rbtnPercent_Clicked"
                                                    GroupName="Radios" AutoPostBack="false" CausesValidation="false" Text="Percent" Checked="true">
                                                </telerik:RadButton>
                                                <telerik:RadButton ID="rbtnPrice" runat="server" ToggleType="Radio" ButtonType="ToggleButton"
                                                    GroupName="Radios" AutoPostBack="false" CausesValidation="false" Text="Price">
                                                </telerik:RadButton>
                                            </div>
                                            <asp:Panel Style="width: 100%" ID="divDiscountPercent" runat="server">
                                                <telerik:RadNumericTextBox ShowSpinButtons="false" Type="Percent" EmptyMessage="Enter Percent" ID="rntxtDiscountPercent" runat="server" OnTextChanged="rntxtDiscountPercent_TextChanged"
                                                    Width="100%" CssClass="RadNumbericText" ClientEvents-OnValueChanged="valueChanged" MinValue="0" IncrementSettings-Step="0.1">
                                                    <ClientEvents OnBlur="OnBlur" />
                                                </telerik:RadNumericTextBox>
                                            </asp:Panel>
                                            <asp:Panel Style="width: 100%; display: none" ID="divDiscountPrice" runat="server">
                                                <telerik:RadNumericTextBox ShowSpinButtons="false" Type="Currency" EmptyMessage="Enter Price" ID="rntxtDiscountPrice" runat="server" OnTextChanged="rntxtDiscountPrice_TextChanged"
                                                    Width="100%" CssClass="RadNumbericText" ClientEvents-OnValueChanged="valueChanged" MinValue="0">
                                                    <ClientEvents OnBlur="OnBlur" />
                                                </telerik:RadNumericTextBox>
                                            </asp:Panel>
                                        </ItemTemplate>
                                    </telerik:GridTemplateColumn>
                                    <telerik:GridTemplateColumn HeaderText="Quantity" UniqueName="Quantity" DataField="Quantity">
                                        <HeaderStyle Font-Bold="true" HorizontalAlign="center" Width="8%" />
                                        <ItemStyle HorizontalAlign="center" Width="8%" />
                                        <FooterStyle HorizontalAlign="center" Width="3%" BackColor="LightBlue" />
                                        <ItemTemplate>
                                            <telerik:RadNumericTextBox ShowSpinButtons="false" Type="Number" ID="rntxtQuantity" runat="server" OnTextChanged="rntxtQuantity_TextChanged"
                                                Width="100%" CssClass="RadNumbericText" ClientEvents-OnValueChanged="valueChanged" MinValue="0">
                                                <ClientEvents OnBlur="OnBlur" />
                                            </telerik:RadNumericTextBox>
                                        </ItemTemplate>
                                        <FooterTemplate>
                                            <asp:Label ID="Label1" runat="server" Text="Total:" Font-Bold="true"/>
                                        </FooterTemplate>
                                    </telerik:GridTemplateColumn>
                                    <telerik:GridTemplateColumn HeaderText="Total Price" UniqueName="TotalPrice" DataField="TotalPrice">
                                        <HeaderStyle Font-Bold="true" HorizontalAlign="center" Width="14%" />
                                        <ItemStyle HorizontalAlign="center" Width="15%" />
                                        <FooterStyle HorizontalAlign="center" Width="7%" BackColor="LightBlue" Font-Bold="true" ForeColor="blue" Font-Size="14px" />
                                        <ItemTemplate>
                                            <telerik:RadNumericTextBox ShowSpinButtons="false" Type="Currency" ID="rntxtTotalPrice" runat="server" ReadOnly="true"
                                                Width="100%" CssClass="RadNumbericText" OnTextChanged="rntxtTotalPrice_TextChanged" ClientEvents-OnValueChanged="TotalPriceOnValueChanged">
                                                <ClientEvents OnBlur="OnBlur" />
                                            </telerik:RadNumericTextBox>
                                        </ItemTemplate>
                                        <FooterTemplate>
                                            <telerik:RadNumericTextBox ID="rntxtTotalPriceFooter" runat="server" ShowSpinButtons="false" Type="Currency" Width="100%"
                                                ReadOnly="true" CssClass="RadNumbericText" LabelWidth="30%">
                                                <ClientEvents OnLoad="Load" />
                                            </telerik:RadNumericTextBox>
                                        </FooterTemplate>
                                    </telerik:GridTemplateColumn>
                                    <telerik:GridTemplateColumn>
                                        <HeaderStyle Font-Bold="true" HorizontalAlign="center" Width="3%" />
                                        <ItemStyle HorizontalAlign="center" Width="3%" />
                                        <ItemTemplate>
                                            <asp:LinkButton ID="lbtnDelete" runat="server" ToolTip="Delete" CommandName="Delete" CausesValidation="false"
                                                OnClientClick="return radConfirmDelete(this, 'Are you sure you want to delete this quote ?');">
                                                    <image src="../Images/delete.png" style="width: 16px; height: 16px"/>
                                            </asp:LinkButton>
                                        </ItemTemplate>
                                        <FooterStyle HorizontalAlign="center" Width="3%" BackColor="LightBlue" />
                                    </telerik:GridTemplateColumn>
                                </Columns>
                                <PagerStyle PageSizes="5,10,20,50" PagerTextFormat="{4}<strong>{5}</strong> quotes in your page"
                                    PageSizeLabelText="Quotes per page:" AlwaysVisible="true" />
                            </MasterTableView>
                            <PagerStyle Mode="NumericPages"></PagerStyle>
                        </telerik:RadGrid>
                    </div>
                </div>
                <div class="clearfix"></div>
            </div>
            <div class="row">
                <div class="col-md-12 btn-edit">
                    <%--<button class="btn btn-defaul" id="btnBottom_Print" runat="server" onserverclick="btn_Print_Click">
                        <i class="glyphicon glyphicon-print"></i>&nbsp Print
                    </button>--%>
                    <asp:LinkButton id="btnBottom_Save" type="button" class="btn btn-defaul" runat="server" OnClick="btn_Save_Click">
                        <img src="../Images/save.png" style="width: 18px; height: 18px" />
                        Save
                    </asp:LinkButton>
                    <asp:LinkButton id="btnBottom_Cancel" runat="server" type="button" class="btn btn-defaul" OnClientClick="CancelClick();" CausesValidation="false">
                        <img src="../Images/back.png" style="width: 18px; height: 18px" />
                        Back
                    </asp:LinkButton>
                </div>
            </div>
        </div>
    </div>
</asp:Content>
